﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VersionComparer.Base;

namespace VersionComparer.Configuration
{
    public class ConfigurationNameAttribute : Attribute
    {

        public ConfigurationNameAttribute(string name)
        {
            Name = name;
        }
        public string Name
        {
            get;
            private set;

        }

        public static string GetTypeConfigurationName<T>()
        {
            return GetTypeConfigurationName(typeof(T));
        }

        public static string GetTypeConfigurationName(Type type)
        {
            ConfigurationNameAttribute attribute =type.GetAttribute<ConfigurationNameAttribute>();
            if (attribute != null)
                return attribute.Name;
            else
                return type.Name;
        }
    }
}
